package com.jt.provider.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ProvideController {
    /*基于@value注解告诉springboot，读取配置文件（application。yml）中
    * 的server。port的值，假如读取不到，则给默认值8080*/
    @Value("${server.port:8080}")
    private String server;
    //http://ip:port/provider/echo/aaa
    @GetMapping("/provider/echo/{msg}")
    public String doRestEcho1(@PathVariable("msg") String msg){
        //return "say hello" + msg;
        return  String.format("%s say hello %s", server,msg);
    }
}
